package com.hfb.mashibing.alip8.juc.c000;

import java.util.concurrent.Executors;

/**
 * 怎样穿件一个线程？
 *
 * 扩展：启动线程的3-4种方式：
 *  1、Thread
 *  2、Runnable
 *  3、Lambda表达式
 *  4、线程池法：Executors.newCachedThreadPool()
 */
public class T02_HowToCreateThread {

    static class MyThread extends Thread {
        @Override
        public void run() {

            System.out.println("Hello MyThread!");
        }
    }
    static class MyRun implements Runnable {
        @Override
        public void run() {
            System.out.println("Hello MyRun!");
        }
    }

    public static void main(String[] args) {
        new MyThread().start();
        new Thread(new MyRun()).start();
        new Thread(()->{
            System.out.println("Hello Lambda!");
        }).start();
    }


}
